/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package data;

import java.io.Serializable;
import java.util.ArrayList;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;

/**
 *
 * @author ajou
 */
@Entity
public class BuildingEntity implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    
    @Column(name="NAME")
    private String name;
    
    @Column(name="LATITUDE")
    private double lati;
    
    @Column(name="LONGITUDE")
    private double longi;
    
    private ArrayList<Integer> questions = new ArrayList<Integer>();

    public ArrayList<Integer> getQuestions() {
        return questions;
    }

    public void setQuestions(ArrayList<Integer> questions) {
        this.questions = questions;
    }
    
    public BuildingEntity(String name, double lati, double longi) {
        this.name = name;
        this.lati = lati;
        this.longi = longi;
    }
    
    public BuildingEntity() {
        
    }

    public void addQuestion(int q) {
        questions.add(q);
    }
    
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public double getLati() {
        return lati;
    }

    public void setLati(double lati) {
        this.lati = lati;
    }

    public double getLongi() {
        return longi;
    }

    public void setLongi(double longi) {
        this.longi = longi;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof BuildingEntity)) {
            return false;
        }
        BuildingEntity other = (BuildingEntity) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        String str = "";
        str += "ID: " + id + "<br>";
        str += "Name: " + name + "<br>";
        str += "Latitude: " + lati + "<br>";
        str += "Longitude: " + longi + "<br>";
        return str;
    }
    
}
